﻿<%@ Page Title="" Language="C#" MasterPageFile="~/front.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="Imobitech.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHeader" runat="server">
    <link type="text/css" href="themes/base/jquery.ui.all.css" rel="stylesheet" />
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.effects.core.js"></script>
    <script type="text/javascript" src="js/jquery.effects.blind.js"></script>
    
    <style type="text/css">
        #effect
        {
            width: 180px;
            height: 135px;
            padding: 0.4em;
            position: relative;
            overflow: auto;
        }
        .textbox
        {
            width: 185px;
            height: 14px;
        }
        body
        {
            font-size: 62.5%;
        }
    </style>

    <script type="text/javascript">
        $(function () {
            $("#effect").hide();
            //run the currently selected effect
            function runEffect() {
                //get effect type from
                if (!($('#effect').is(":visible"))) {
                    //run the effect
                    $("#effect").show('blind', 200);
                }
                else {
                    $("#effect").hide('blind', 200);
                }
            };

            //set effect from select menu value
            $("#ddlArrow").click(function () {
                runEffect();
                return false;
            });


            $(document).click(function (e) { if (($('#effect').is(":visible"))) { $("#effect").hide('blind', 1000); } });

            $('#effect').click(function (e) {
                e.stopPropagation();
            });
        });
	</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderContent" runat="server">
    <fieldset>
        <div class="clearfix">
            <label>
                Estado:
            </label>
            <div class="input">
                <asp:TextBox ID="txtEstado" runat="server" CssClass="xlarge"></asp:TextBox>
            </div>
            <label>
                Cidade:
            </label>
            <div class="input">
                <asp:TextBox ID="txtCidade" runat="server" CssClass="xlarge"></asp:TextBox>
            </div>
            <label>
                Bairro:
            </label>
            <div class="input">
                <div class="toggler">
                    <span>
                        <asp:TextBox ID="txtBairro" runat="server" CssClass="textbox"></asp:TextBox>
                        <img id="ddlArrow" src="images/down_arrow.jpg" style="margin-left: -23px; margin-bottom: -4px" />
                    </span>
                    <div id="effect" class="ui-widget-content">
                        <asp:CheckBoxList ID="chkList" runat="server" onclick="GetSelectedValue();">
                        </asp:CheckBoxList>
                    </div>
                </div>
            </div>
             <label>
                Tipo de Procura:
            </label>
            <div class="input">
                <asp:DropDownList ID="ddlTipo" runat="server" CssClass="xlarge"></asp:DropDownList>
            </div>
            <label>
                Tipo de Imóvel:
            </label>
            <div class="input">
                <asp:DropDownList ID="ddlTipoImovel" runat="server" CssClass="xlarge"></asp:DropDownList>
            </div>
        </div>
        <div class="clearfix">
            <div class="input">
                <asp:Button ID="btnBuscar" runat="server" OnClick="btnBuscar_Click" Text="Buscar" />
            </div>
        </div>
    </fieldset>
    <h2>
        Venda</h2>
    <asp:Repeater ID="rptAnunciosVenda" runat="server">
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
            <%#((((RepeaterItem)Container).ItemIndex) % 2) == 0 ? "<div class='row'>" : ""%>
            <div class='span6'>
                <img src='Imovel/upload/<%# DataBinder.Eval(Container.DataItem, "idImovel")%>/<%# DataBinder.Eval(Container.DataItem, "caminho")%>'  width="72" height="72"  />
                <p>
                    <%# DataBinder.Eval(Container.DataItem, "descricao")%></p>
                <p>
                    <a class="btn" href='<%# DataBinder.Eval(Container.DataItem, "url") %>' runat="server">View details &raquo;</a></p>
            </div>
            <%#((((RepeaterItem)Container).ItemIndex) % 2) == 0 ? "" : "</div>"%>
        </ItemTemplate>
        <FooterTemplate>
            </div>
        </FooterTemplate>
    </asp:Repeater>
    <div class="pagination">
        <ul id="ulpagination" runat="server">
        </ul>
    </div>
    <script language="javascript">
        function GetSelectedValue() {
            var chkBox = document.getElementById("<%=chkList.ClientID%>");
            var checkbox = chkBox.getElementsByTagName("input");
            var objTextBox = document.getElementById("<%=txtBairro.ClientID%>");
            var counter = 0;
            objTextBox.value = "";
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked) {
                    var chkBoxText = checkbox[i].parentNode.getElementsByTagName('label');
                    if (objTextBox.value == "") {
                        objTextBox.value = chkBoxText[0].innerHTML;
                    }
                    else {
                        objTextBox.value = objTextBox.value + ", " + chkBoxText[0].innerHTML;
                    }
                }
            }
        }
</script>
</asp:Content>
